package com.dxp.operation.config;

import com.dxp.operation.core.OperationInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author gaohui
 */
@Configuration
public class MvcConfig implements WebMvcConfigurer {

    private final OperationInterceptor operationInterceptor;

    public MvcConfig(OperationInterceptor operationInterceptor) {
        this.operationInterceptor = operationInterceptor;
    }

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(operationInterceptor).addPathPatterns("/**");
    }
}
